<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commonjsp/jstl.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>商品管理</title>
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link rel="stylesheet" type="text/css" href="${prefix}/stylesheets/theme.css">
<link rel="stylesheet" type="text/css" href="${prefix}/stylesheets/reveal.css">
<link rel="stylesheet" type="text/css" href="${prefix}/lib/font-awesome/css/font-awesome.css">
<link rel="stylesheet" type="text/css" href="${prefix}/lib/bootstrap/css/bootstrap.css">

<script src="${prefix}/lib/jquery-1.8.1.min.js" type="text/javascript"></script>
<script src="${prefix}/lib/ajaxfileupload.js" type="text/javascript"></script>
<script src="${prefix}/lib/jquery-form.js" type="text/javascript"></script>
<script src="${prefix}/lib/jquery.reveal.js" type="text/javascript"></script>
<!-- Demo page code -->
<style type="text/css">
#line-chart {
	height:300px;
	width:800px;
	margin: 0px auto;
	margin-top: 1em;
}

.brand { font-family: georgia, serif; }
.brand .first {
	color: #ccc;
	font-style: italic;
}
.brand .second {
	color: #fff;
	font-weight: bold;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
	//首先按照当前登录管理员的角色，查询“可控制”的公司信息
	$.ajax({
		type: "post",
		async: true,
		url: "${prefix}/company/queryCompany",
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			
			var companys = jsonData.data;
			var html = "";
			for(var index = 0 ; companys != null && index < companys.length ; index++) {
				var company = companys[index];
				html += "<div class=\"nav-header collapsed\" onclick=\"loadCompanyTypes('" + company.uid + "','" + company.companyName + "')\" reloadTypes=\"false\" id=\"company_" + company.uid + "\" data-toggle=\"collapse\" data-target=\"#company_type_" + company.uid + "\" style=\"background:-webkit-gradient(linear, left bottom, left top, color-stop(0, #dddddd), color-stop(1, #ffffff))\">" + company.companyName + "</div>";
				html += "<ul id=\"company_type_" + company.uid + "\" class=\"nav nav-list collapse\" style=\"padding-left: 30px ; font-size: 5px\">";
				html += "<li id=\"appendtypeitem_" + company.uid + "\"><a href=\"javascript:void(0);\" onclick=\"perAppendType('" + company.uid + "','" + company.companyName + "')\" data-reveal-id=\"appendTypesDiv\" style=\"color:#FF0000\">点击此处增加目录</a></li>";;
				html += "</ul>";
			}
			
			$("#companyAndtypeDiv").html(html);
		}
	});
});

//加载这个公司对应的商品目录（如果reloadTypes == true）就不需要加载了
function loadCompanyTypes(companyid , companyName) {
	var typeDiv = $("#company_type_" + companyid);
	var companyDiv = $("#company_" + companyid);
	
	//如果条件成立，就不需要在进行加载了
	if(companyDiv.attr("reloadTypes") == "true") {
		return;
	}
	
	//读取这个公司的商品目录信息
	$.ajax({
		type: "post",
		async: false,
		url: "${prefix}/commodity/queryCommodityTypesByCompany?companyid=" + companyid ,
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			
			var types = jsonData.data;
			var html = "";
			for(var index = 0 ; types != null && index < types.length ; index++) {
				var type = types[index];
				html += "<li name=\"catalogue\" id=\"typeitem_" + type.uid + "\" onclick=\"onCatalogueSelected(this , '" + type.uid + "' , '" + type.typeName + "' , '" + companyid + "' , '" + companyName + "')\"><a href=\"javascript:void(0);\">" + type.typeName + "</a></li>";
			}
			html += "<li id=\"appendtypeitem_" + companyid + "\"><a href=\"javascript:void(0);\" onclick=\"perAppendType('" + companyid + "','" + companyName + "')\" data-reveal-id=\"appendTypesDiv\" style=\"color:#FF0000\">点击增加目录</a></li>";;
			if(types != null && types.length > 0) {
				html += "<li id=\"appendtypeitem_" + companyid + "\"><a href=\"javascript:void(0);\" onclick=\"perModifyType('" + companyid + "','" + companyName + "')\" style=\"color:#0000FF\">点击修改选中目录</a></li>";;
			}
			
			$("#company_type_" + companyid).html(html);
			companyDiv.attr("reloadTypes" , "true");
		}
	});
}

//进行商品目录的添加前，进行添加页面数据的初始化
function perAppendType(companyid , companyname) {
	$("#appendType_companyid").val(companyid);
	$("#appendType_companyname").val(companyname);
	$("#appendtype_companyname_label").html("公司名：" + companyname);
	$("#appendtype_typename").val("");
	$("#appendtype_typeerror").html("");
}

//进行商品目录的添加
function appendType() {
	var companyid = $("#appendType_companyid").val();
	var companyname = $("#appendType_companyname").val();
	
	//首先进行判断
	var typename = $.trim($("#appendtype_typename").val());
	var goodForm = true;
	var error = "";
	if(typename == "") {
		goodForm = false;
		error += "目录名称必须填写！\r";
	}
	
	//验证这个目录名称是否已被使用
	var data = encodeURI("companyid=" + companyid + "&typename=" + typename);
	$.ajax({
		type: "post",
		async: false,
		url: "${prefix}/commodity/queryCommodityTypeByName" ,
		data: data,
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				goodForm = false;
				error += jsonData.errorinfo + "\r";
			}
			
			//如果条件成立，说明已经有商品目录信息了
			if(jsonData.data != null) {
				goodForm = false;
				error += "该目录名称已被使用，请更换！\r";
			}
		}
	});
	
	if(!goodForm) {
		alert(error);
		return;
	}
	
	//开始添加
	var data = encodeURI("companyid=" + companyid + "&typename=" + typename);
	$.ajax({
		type: "post",
		async: false,
		url: "${prefix}/commodity/appendCommodityType" ,
		data: data,
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			
			//清空表单
			$("#appendtype_typename").val("");
			$("#appendtype_typeerror").html("");
			var companyDiv = $("#company_" + companyid);
			companyDiv.attr("reloadTypes" , "false");
			//重新加载该公司下的商品目录信息
			loadCompanyTypes(companyid , companyname);
			
			alert("目录添加成功，您可以继续添加，也可以关闭该对话框！");
		}
	});
}

//当某个商品目录被选定时
function onCatalogueSelected(selectedCatalogue , typeuid , typeName , companyid , companyName) {
	//清空所有的active
	$("li[name='catalogue']").attr("class","");
	$(selectedCatalogue).attr("class","active");
	
	//开始进行查询指定目录的商品信息（无论商品状态）
	$("#commodityTableBody").html("");
	//刷新列表
	reflushTable(typeuid , typeName , companyid , companyName);
}

function reflushTable(typeuid , typeName , companyid , companyName) {
	$.ajax({
		type: "post",
		async: true,
		url: "${prefix}/commodity/queryCommoditysByType?typeid=" + typeuid,
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			
			var commoditys = jsonData.data;
			drawtable(commoditys , typeuid , typeName , companyid , companyName);
		}
	});
}

//绘制表格
function drawtable(commoditys, typeuid , typeName , companyid , companyName) {
	//书写表单
	var html = "";
	for(var index = 0 ; commoditys != null && index < commoditys.length ; index++) {
		var commodity = commoditys[index];
		html += "<tr>";
		html += "<td>" + commodity.commodityCode + "</td>";
		html += "<td>" + commodity.commodityName + "</td>";
		html += "<td>" + commodity.sortName + "</td>";
		html += "<td>" + commodity.createTime + "</td>";
		html += "<td>" + commodity.remark + "</td>";
		if(commodity.status == 1) {
			html += "<td>正常</td>";
		} else {
			html += "<td style=\"color:#FF0000\">已作废</td>";
		}
		//=======相关功能
		html += "<td style=\"width: 120px\">";
		html += "<a href=\"javascript:void(0);\" onclick=\"perModifyCommodity('" + commodity.uid + "','" + companyName + "','" + typeName + "')\" data-reveal-id=\"modifyCommodifyDiv\">编辑</a>&nbsp;&nbsp;&nbsp;";
		if(commodity.status == 1) {
			html += "<a href=\"javascript:void(0);\" onclick=\"modifyCommodityStatus('" + commodity.uid + "')\">作废</a>";
		} else {
			html += "<a href=\"javascript:void(0);\" onclick=\"modifyCommodityStatus('" + commodity.uid + "')\">启用</a>";
		}
		html += "</td>";
		html += "</tr>";
	}
	
	$("#commodityTableBody").html(html);
	$("#selectedTypeid").val(typeuid);
	$("#selectedTypeName").val(typeName);
	$("#selectedCompanyid").val(companyid);
	$("#selectedCompanyName").val(companyName);
	$("#company_commdify_label").html(companyName + "——" + typeName + "：");
	$("#perAppendCommoditybutton").attr("data-reveal-id" , "appendCommodifyDiv");
}

//对指定商品目录的修改前的数据准备
function perModifyType(companyuid , companyName) {
	alert("敬请期待");
}

//在指定目录下添加商品信息的页面初始化功能
function perAppendCommodity() {
	var selectedTypeid = $("#selectedTypeid").val();
	var selectedTypeName = $("#selectedTypeName").val();
	var selectedCompanyid = $("#selectedCompanyid").val();
	var selectedCompanyName = $("#selectedCompanyName").val();
	
	if(selectedTypeid == null || selectedTypeid == ""
		|| selectedCompanyid == null ||selectedCompanyid == "") {
		alert("请首先选定一个商品目录，再进行商品的添加！");
		return;
	}
	
	$("#appendCommodify_companyname_label").html(selectedCompanyName + "——" + selectedTypeName);
	$("#appendCommodify_commodifyCode").val("");
	$("#appendCommodify_commodifyName").val("");
	$("#appendCommodify_commodifySort").val("");
	$("#appendCommodify_commodifyRemark").val("");
}

//添加新的商品
function appendCopmmodify() {
	var selectedTypeid = $("#selectedTypeid").val();
	var selectedTypeName = $("#selectedTypeName").val();
	var selectedCompanyid = $("#selectedCompanyid").val();
	var selectedCompanyName = $("#selectedCompanyName").val();
	
	
	var commodifyCode = $.trim($("#appendCommodify_commodifyCode").val());
	var commodifyName = $.trim($("#appendCommodify_commodifyName").val());
	var commodifySort = $.trim($("#appendCommodify_commodifySort").val());
	var commodifyRemark = $.trim($("#appendCommodify_commodifyRemark").val());
	//===========首先进行填写信息的验证
	var goodForm = true;
	var error = "";
	if(commodifyCode == "") {
		goodForm = false;
		error += "请填写商品编号！\r";
	}
	if(commodifyName == "") {
		goodForm = false;
		error += "请填写商品名称！\r";
	}
	if(commodifySort == "") {
		goodForm = false;
		error += "请填写商品简称！\r";
	}
	
	//===========然后进行重复性验证
	//商品编码
	if(commodifyCode != "") {
		var data = encodeURI("companyid=" + selectedCompanyid + "&commodityCode=" + commodifyCode);
		$.ajax({
			type: "post",
			async: false,
			url: "${prefix}/commodity/queryCommodityByCommodityCode" ,
			data: data,
			success: function(data) {
				var jsonData = eval('(' + data + ')');
				//错误信息
				if(jsonData.responsecode != "E200") {
					alert(jsonData.errorinfo);
					return;
				}
				
				var commodity = jsonData.data;
				if(commodity != null) {
					goodForm = false;
					error += "该商品编码已被使用，请更换！\r";
				}
			}
		});
	}
	//商品名称
	if(commodifyName != "") {
		data = encodeURI("companyid=" + selectedCompanyid + "&commodityName=" + commodifyName);
		$.ajax({
			type: "post",
			async: false,
			url: "${prefix}/commodity/queryCommodityByCommodityName" ,
			data: data,
			success: function(data) {
				var jsonData = eval('(' + data + ')');
				//错误信息
				if(jsonData.responsecode != "E200") {
					alert(jsonData.errorinfo);
					return;
				}
				
				var commodity = jsonData.data;
				if(commodity != null) {
					goodForm = false;
					error += "该商品编码已被使用，请更换！\r";
				}
			}
		});
	}
	//商品简称
	if(commodifySort != "") {
		data = encodeURI("companyid=" + selectedCompanyid + "&sortName=" + commodifySort);
		$.ajax({
			type: "post",
			async: false,
			url: "${prefix}/commodity/queryCommodityBySortName" ,
			data: data,
			success: function(data) {
				var jsonData = eval('(' + data + ')');
				//错误信息
				if(jsonData.responsecode != "E200") {
					alert(jsonData.errorinfo);
					return;
				}
				
				var commodity = jsonData.data;
				if(commodity != null) {
					goodForm = false;
					error += "该商品简称已被使用，请更换！\r";
				}
			}
		});
	}
	if(!goodForm) {
		alert(error);
		return;
	}
	
	//===========再进行提交、提示和初始化
	data = encodeURI("companyid=" + selectedCompanyid + "&typeid=" + selectedTypeid + "&commodityCode=" + commodifyCode + "&commodityName=" + commodifyName + "&sortName=" + commodifySort + "&remark=" + commodifyRemark);
	$.ajax({
		type: "post",
		async: false,
		url: "${prefix}/commodity/appendCommodity",
		data: data,
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			
			//清空原有数据
			$("#appendCommodify_commodifyCode").val("");
			$("#appendCommodify_commodifyName").val("");
			$("#appendCommodify_commodifySort").val("");
			$("#appendCommodify_commodifyRemark").val("");
			//刷新列表
			reflushTable(selectedTypeid , selectedTypeName , selectedCompanyid , selectedCompanyName);
			
			alert("目录添加成功，您可以继续添加，也可以关闭该对话框！");
		}
	});
}

//修改指定用户的状态。
function modifyCommodityStatus(commodityid) {
	var selectedTypeid = $("#selectedTypeid").val();
	var selectedTypeName = $("#selectedTypeName").val();
	var selectedCompanyid = $("#selectedCompanyid").val();
	var selectedCompanyName = $("#selectedCompanyName").val();
	$.ajax({
		type: "post",
		async: true, 
		url: "${prefix}/commodity/modifyCommodityStatus?commodityid=" + commodityid, 
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			
			//重新查询列表
			reflushTable(selectedTypeid , selectedTypeName , selectedCompanyid , selectedCompanyName);
		}
	});
}

//修改指定商品前的数据准备函数
function perModifyCommodity(commodityid , companyname , commodityType) {
	$.ajax({
		type: "post",
		async: true, 
		url: "${prefix}/commodity/queryCommodityByid?commodityid=" + commodityid, 
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			var commodity = jsonData.data;
			
			$("#modifyCommodify_commodifyid").val(commodityid);
			$("#modifyCommodify_companyname_label").html(companyname + "-" + commodityType);
			$("#modifyCommodify_commodifyCode").val(commodity.commodityCode);
			$("#modifyCommodify_commodifyName").val(commodity.commodityName);
			$("#modifyCommodify_commodifySort").val(commodity.sortName);
			$("#modifyCommodify_commodifyRemark").val(commodity.remark);
			
			//=======注意，一定要记录原始值，以便进行验证比较
			$("#modifyCommodify_commodifyCode_hidden").val(commodity.commodityCode);
			$("#modifyCommodify_commodifyName_hidden").val(commodity.commodityName);
			$("#modifyCommodify_commodifySort_hidden").val(commodity.sortName);
			$("#modifyCommodify_commodifyRemark_hidden").val(commodity.remark);
		}
	});
}

//进行商品基本信息的修改
function modifyCopmmodify() {
	//===========首先记录原始值
	var oldCommodifyCode = $("#modifyCommodify_commodifyCode_hidden").val();
	var oldCommodityName = $("#modifyCommodify_commodifyName_hidden").val();
	var oldSortName = $("#modifyCommodify_commodifySort_hidden").val();
	var oldRemark = $("#modifyCommodify_commodifyRemark_hidden").val();
	
	//==========判断不能为空值
	var commodifyCode = $.trim($("#modifyCommodify_commodifyCode").val());
	var commodityName = $.trim($("#modifyCommodify_commodifyName").val());
	var sortName = $.trim($("#modifyCommodify_commodifySort").val());
	var remark = $.trim($("#modifyCommodify_commodifyRemark").val());
	var commodifyid = $("#modifyCommodify_commodifyid").val();
	
	//==========首先判断不能为空
	var goodForm = true;
	var error = "";
	if(commodifyCode == "") {
		goodForm = false;
		error += "请填写商品编号！\r";
	}
	if(commodityName == "") {
		goodForm = false;
		error += "请填写商品名称！\r";
	}
	if(sortName == "") {
		goodForm = false;
		error += "请填写商品简称！\r";
	}
	if(!goodForm) {
		alert(error);
		return;
	}
	
	//==========组装返回值
	var html = "commodifyid=" + commodifyid;
	if(commodifyCode != oldCommodifyCode) {
		html += "&commodifyCode=" + commodifyCode;
	}
	if(commodityName != oldCommodityName) {
		html += "&commodifyName=" + commodityName;
	}
	if(sortName != oldSortName) {
		html += "&commodifySort=" + sortName;
	}
	if(remark != oldRemark && remark != "") {
		html += "&remark=" + remark;
	}
	var data = encodeURI(html);
	
	$.ajax({
		type: "post",
		async: true, 
		url: "${prefix}/commodity/modifyCommodity",
		data: data,
		success: function(data) {
			var jsonData = eval('(' + data + ')');
			//错误信息
			if(jsonData.responsecode != "E200") {
				alert(jsonData.errorinfo);
				return;
			}
			
			//重新查询列表
			var selectedTypeid = $("#selectedTypeid").val();
			var selectedTypeName = $("#selectedTypeName").val();
			var selectedCompanyid = $("#selectedCompanyid").val();
			var selectedCompanyName = $("#selectedCompanyName").val();
			reflushTable(selectedTypeid , selectedTypeName , selectedCompanyid , selectedCompanyName);
			alert("修改商品信息成功，您可以继续修改，也可以退出该对话框！");
		}
	});
}
</script>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
	<script src="${prefix}/javascripts/html5.js"></script>
<![endif]-->
<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="${prefix}/lib/font-awesome/docs/assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs/assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs//assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs//assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed" href="${prefix}/lib/font-awesome/docs//assets/ico/apple-touch-icon-57-precomposed.png">
</head>

<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7"> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8"> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> 
<body>
<!--<![endif]-->

<div class="navbar">
	<%@ include file="/commonjsp/userbar.jsp"%>
</div>

<div class="container-fluid">
	<div class="row-fluid">
		<%@ include file="/commonjsp/mainmenu.jsp"%>
		<!-- 列表 -->
		<div class="span9">
			<!-- 列表头 -->
			<h1 class="page-title">商品码单管理</h1>
			
			<!-- 公司树 -->
			<div class="well" id="companyAndtypeDiv" style="width: 150px;height: 480px; float: left; margin-right:10px ; padding: 5px ; overflow-y:none ; overflow-x:hidden;">
				
			</div>
			
			<!-- 文件信息 -->
			<div class="well" style="float: left; min-width: 900px; margin-bottom: 5px ; padding-bottom: 10px">
				<label id="company_commdify_label"></label> 
				<label style="float: left; padding-right: 10px">
					<a href="javascript:void(0);" id="perAppendCommoditybutton" onclick="perAppendCommodity()" class="btn btn-primary"> 创建商品</a>
				</label>
			</div>
			
			<!-- 列表正文 -->
			<div class="well" style="float: left; min-width: 900px; margin-top: 5px">
				<input type="hidden" id="selectedTypeid"/>
				<input type="hidden" id="selectedTypeName"/>
				<input type="hidden" id="selectedCompanyid"/>
				<input type="hidden" id="selectedCompanyName"/>
				<table class="table">
					<thead>
						<tr>
							<th>编号</th>
							<th>商品名</th>
							<th>简称</th> 
							<th>创建时间</th>
							<th>商品说明</th>
							<th>状态</th> 
							<th>操作</th>
						</tr>
					</thead>
					<tbody id="commodityTableBody">
						
					</tbody>
				</table>
			</div>
		</div>
	</div>
	
	<!-- Le javascript
	================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="${prefix}/lib/bootstrap/js/bootstrap.js"></script>
	
	<!-- 商品创建 -->
	<div id="appendCommodifyDiv" class="reveal-modal" style="width: 200px;height: 380px;">
		<label style="padding: 5px;margin: 0px;">所属：</label>
		<label style="padding: 5px;margin: 0px;" id="appendCommodify_companyname_label"></label>
		<label style="padding: 5px;margin: 0px;">商品编号：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="appendCommodify_commodifyCode" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
			<input type="hidden" value="" id="appendCommodify_commodifyCode_hidden"/>
		</label>
		<label style="padding: 5px;margin: 0px;">商品名称：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="appendCommodify_commodifyName" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
			<input type="hidden" value="" id="appendCommodify_commodifyName_hidden"/>
		</label>
		<label style="padding: 5px;margin: 0px;">商品简称：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="appendCommodify_commodifySort" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
			<input type="hidden" value="" id="appendCommodify_commodifySort_hidden"/>
		</label>
		<label style="padding: 5px;margin: 0px;">商品说明：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="appendCommodify_commodifyRemark" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
			<input type="hidden" value="" id="appendCommodify_commodifyRemark_hidden"/>
		</label>
		<label style="padding: 5px;margin: 0px;">
			<a href="javascript:void(0);" onclick="appendCopmmodify()" id="appendTypesButton" class="btn btn-primary" ><i class="icon-save"></i> 保 存 </a>
		</label>
		<a class="close-reveal-modal">×</a>
	</div>
	
	<!-- 商品修改、只能修改商品编号、名称和简称。注意接口是传什么改什么 -->
	<div id="modifyCommodifyDiv" class="reveal-modal" style="width: 200px;height: 380px;">
		<input type="hidden" id="modifyCommodify_commodifyid"/>
		<label style="padding: 5px;margin: 0px;">所属：</label>
		<label style="padding: 5px;margin: 0px;" id="modifyCommodify_companyname_label"></label>
		<label style="padding: 5px;margin: 0px;">商品编号：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="modifyCommodify_commodifyCode" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
		</label>
		<label style="padding: 5px;margin: 0px;">商品名称：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="modifyCommodify_commodifyName" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
		</label>
		<label style="padding: 5px;margin: 0px;">商品简称：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="modifyCommodify_commodifySort" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
		</label>
		<label style="padding: 5px;margin: 0px;">商品说明：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="modifyCommodify_commodifyRemark" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
		</label>
		<label style="padding: 5px;margin: 0px;">
			<a href="javascript:void(0);" onclick="modifyCopmmodify()" class="btn btn-primary" ><i class="icon-save"></i> 修 改 </a>
		</label>
		<a class="close-reveal-modal">×</a>
	</div>
	
	<!-- 商品目录创建 -->
	<div id="appendTypesDiv" class="reveal-modal" style="width: 200px;height: 180px;">
		<input id="appendType_companyid" type="hidden"/>
		<input id="appendType_companyname" type="hidden"/>
		<label style="padding: 5px;margin: 0px;">所属公司：</label>
		<label style="padding: 5px;margin: 0px;" id="appendtype_companyname_label"></label>
		<label style="padding: 5px;margin: 0px;">目录名称：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="appendtype_typename" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
		</label>
		<label style="padding: 5px;margin: 0px; display: none ; color: #FF0000" id="appendtype_typeerror"></label>
		<label style="padding: 5px;margin: 0px;">
			<a href="javascript:void(0);" onclick="appendType()" id="appendTypesButton" class="btn btn-primary" ><i class="icon-save"></i> 增 加 </a>
		</label>
		<a class="close-reveal-modal">×</a>
	</div>
	
	<!-- 商品目录修改 -->	
	<div id="modifyTypesDiv" class="reveal-modal" style="width: 200px;height: 180px;">
		<input id="modifyType_companyid" type="hidden"/>
		<input id="modifyType_companyname" type="hidden"/>
		<label style="padding: 5px;margin: 0px;">所属公司：</label>
		<label style="padding: 5px;margin: 0px;" id="modifytype_companyname_label"></label>
		<label style="padding: 5px;margin: 0px;">目录名称：</label>
		<label style="padding: 5px;margin: 0px;">
			<input type="text" value="" id="modifytype_typename" maxlength="20" style="width: 180px ; height: 30px ; padding: 0px ; margin: 0px;"/>
		</label>
		<label style="padding: 5px;margin: 0px; display: none ; color: #FF0000" id="modifytype_typeerror"></label>
		<label style="padding: 5px;margin: 0px;">
			<a href="javascript:void(0);" onclick="modifyType()" id="appendTypesButton" class="btn btn-primary" ><i class="icon-save"></i> 修 改 </a>
		</label>
		<a class="close-reveal-modal">×</a>
	</div>
</div>
</body>
</html>